<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * @remark 原本想把检查登录用户的有效性写成一个函数，这样可以在前台检查用户登录的时候能够用上，但是最后并没有用上
 */

function login_valid($conn, $sql, $dest_page)
{
    $stmt = exectue_sql_statement($conn, $sql);
    if (sqlsrv_fetch_array($stmt) == false) {
        echo "<script type='text/javascript' charset='UTF-8'>alert('用户名或密码错误!');history.back();</script>";
        exit;
    } else {
        header("location:".$dest_page);
    }
}

?>